<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统管理</el-breadcrumb-item>
      <el-breadcrumb-item>参数设置</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
        <el-row :gutter="20">


            <el-col :span="13">
            <el-label>急转弯</el-label>
 
        </el-col>


      </el-row>
      <el-row>
         <el-col :span="15">
                <el-label>角速度：瞬间角加速度≥k1°每平方秒>瞬间角加速度≥k2°每平方秒>瞬间角加速度≥k3°每平方秒</el-label>
            </el-col>
</el-row>

      <el-row>
           <el-col :span="1">
                <el-label>k1:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="k1"
            v-model="turnSpeed1"

          >
          </el-input>
          
        </el-col>
        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>k2:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="k2"
            v-model="turnSpeed2"
          >
          </el-input>
        </el-col>

        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>k3:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="k3"
            v-model="turnSpeed3"
          >
          </el-input>
        </el-col>

      </el-row>


  <el-divider></el-divider>
      <el-row>
         <el-col :span="15">
                <el-label>转弯角度：d1°≤角度＜d2°≤角度＜d3°≤角度＜d4°</el-label>
            </el-col>
</el-row>

      <el-row>
           <el-col :span="1">
                <el-label>d1:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="d1"
            v-model="turnAngle1"

          >
          </el-input>
          
        </el-col>
        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>d2:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="d2"
            v-model="turnAngle2"
          >
          </el-input>
        </el-col>

        <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>d3:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="d3"
            v-model="turnAngle3"
          >
          </el-input>
        </el-col>

                <el-col :span="2">
            <el-label>&nbsp</el-label>   
        </el-col>

                    <el-col :span="1">
                <el-label>d4:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="d4"
            v-model="turnAngle4"
          >
          </el-input>
        </el-col>

      </el-row>

      <el-row>
           <el-col :span="1.5">
                <el-label>持续时间:</el-label>
            </el-col>
        <el-col :span="1">
             <el-input
            placeholder="d1"
            v-model="turnlast"

          >
          </el-input>
          
        </el-col>
        <el-col :span="1">
                <el-label>s(秒)</el-label>
            </el-col>
 
      </el-row>

<el-divider></el-divider>
<el-row>
         <el-col :span="15">
                <el-label>触发=1</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="15">
                <el-label>急转弯判断指标：</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="6.5">
                <el-label>1、角加速度：{{turnSpeed2}}°每平方秒≥瞬间角加速度≥{{turnSpeed3}}°每平方秒</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="9.4">
                <el-label>2、3秒内转弯角度在{{turnAngle1}}—{{turnAngle2}}°之间(包括{{turnAngle1}}°，不包括{{turnAngle2}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1P1"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1S1"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle2}}—{{turnAngle3}}°之间(包括{{turnAngle2}}°，不包括{{turnAngle3}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1P2"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1S2"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle3}}—{{turnAngle4}}°之间(包括{{turnAngle3}}°，不包括{{turnAngle4}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1P3"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn1S3"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>




<el-divider></el-divider>
<el-row>
         <el-col :span="15">
                <el-label>触发=2</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="15">
                <el-label>急转弯判断指标：</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="6.5">
                <el-label>1、角加速度：{{turnSpeed1}}°每平方秒≥瞬间角加速度≥{{turnSpeed2}}°每平方秒</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="9.4">
                <el-label>2、3秒内转弯角度在{{turnAngle1}}—{{turnAngle2}}°之间(包括{{turnAngle1}}°，不包括{{turnAngle2}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2P1"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2S1"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle2}}—{{turnAngle3}}°之间(包括{{turnAngle2}}°，不包括{{turnAngle3}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2P2"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2S2"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle3}}—{{turnAngle4}}°之间(包括{{turnAngle3}}°，不包括{{turnAngle4}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2P3"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn2S3"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-divider></el-divider>
<el-row>
         <el-col :span="15">
                <el-label>触发=3</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="15">
                <el-label>急转弯判断指标：</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="6.5">
                <el-label>1、角加速度：瞬间角加速度≥{{turnSpeed1}}°每平方秒</el-label>
            </el-col>
</el-row>
<el-row>
         <el-col :span="9.4">
                <el-label>2、3秒内转弯角度在{{turnAngle1}}—{{turnAngle2}}°之间(包括{{turnAngle1}}°，不包括{{turnAngle2}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3P1"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3S1"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle2}}—{{turnAngle3}}°之间(包括{{turnAngle2}}°，不包括{{turnAngle3}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3P2"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3S2"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

<el-row>
         <el-col :span="9.4">
                <el-label>3、3秒内转弯角度在{{turnAngle3}}—{{turnAngle4}}°之间(包括{{turnAngle3}}°，不包括{{turnAngle4}}°)，且{{turnlast}}秒内速度减少小于</el-label>
            </el-col>
                <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3P3"
                    ></el-input>
                </el-col>
            <el-col :span="2.5">
                <el-label>，且平均速度大于</el-label>
            </el-col>
            <el-col :span="1">
                    <el-input
                        placeholder="d1"
                        v-model="turn3S3"
                    ></el-input>
                </el-col>
            <el-col :span="1">
                <el-label> m/s；</el-label>
            </el-col>
</el-row>

        <el-row type="flex" justify="end">
            <el-button type="primary" @click="updateparam()" icon="el-icon-edit"
                        >确定修改</el-button>
            </el-row>
    </el-card>

  </div>
</template>

<script>

export default {
  data () {
    return {

      nowcontact: {},

      paramList: [],
      turnSpeed1:0,turnSpeed2:0,turnSpeed3:0,
      turnAngle1:0,turnAngle2:0,turnAngle3:0,turnAngle4:0,
      turnlast:0,

      turn1P1:0,turn1P2:0,turn1P3:0,
      turn1S1:0,turn1S2:0,turn1S3:0,

      turn2P1:0,turn2P2:0,turn2P3:0,
      turn2S1:0,turn2S2:0,turn2S3:0,
      
      turn3P1:0,turn3P2:0,turn3P3:0,
      turn3S1:0,turn3S2:0,turn3S3:0,
    }
  },
  created () {
    // 加载页面时 加载一次数据
    this.getparamList()

  },
  methods: {
  
  async getparamList() {
      const { data: res } = await this.$http.get('param/getparam/turn')
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.paramList = res.data

      this.turnSpeed1 = this.paramList[0].value
      this.turnSpeed2 = this.paramList[1].value
      this.turnSpeed3 = this.paramList[2].value

      this.turnAngle1 = this.paramList[3].value
      this.turnAngle2 = this.paramList[4].value
      this.turnAngle3 = this.paramList[5].value
      this.turnAngle4 = this.paramList[6].value

      this.turnlast = this.paramList[7].value

      this.turn1P1 = this.paramList[8].value
      this.turn1P2 = this.paramList[9].value
      this.turn1P3 = this.paramList[10].value
      this.turn1S1 = this.paramList[11].value
      this.turn1S2 = this.paramList[12].value
      this.turn1S3 = this.paramList[13].value

      this.turn2P1 = this.paramList[14].value
      this.turn2P2 = this.paramList[15].value
      this.turn2P3 = this.paramList[16].value
      this.turn2S1 = this.paramList[17].value
      this.turn2S2 = this.paramList[18].value
      this.turn2S3 = this.paramList[19].value

      this.turn3P1 = this.paramList[20].value
      this.turn3P2 = this.paramList[21].value
      this.turn3P3 = this.paramList[22].value
      this.turn3S1 = this.paramList[23].value
      this.turn3S2 = this.paramList[24].value
      this.turn3S3 = this.paramList[25].value


    },


    async updateparam () {
      const { data: res } = await this.$http.post(
        'param/updateparam',
        {
        'turnSpeed1': this.turnSpeed1, 
        'turnSpeed2': this.turnSpeed2,
        'turnSpeed3': this.turnSpeed3,  

        'turnAngle1': this.turnAngle1, 
        'turnAngle2': this.turnAngle2, 
        'turnAngle3': this.turnAngle3, 
        'turnAngle4': this.turnAngle4, 

        'turn1P1': this.turn1P1, 
        'turn1P2': this.turn1P2, 
        'turn1P3': this.turn1P3, 
        'turn1S1': this.turn1S1, 
        'turn1S2': this.turn1S2, 
        'turn1S3': this.turn1S3, 

        'turn2P1': this.turn2P1, 
        'turn2P2': this.turn2P2, 
        'turn2P3': this.turn2P3, 
        'turn2S1': this.turn2S1, 
        'turn2S2': this.turn2S2, 
        'turn2S3': this.turn2S3, 

        'turn3P1': this.turn3P1, 
        'turn3P2': this.turn3P2, 
        'turn3P3': this.turn3P3, 
        'turn3S1': this.turn3S1, 
        'turn3S2': this.turn3S2, 
        'turn3S3': this.turn3S3, 
        'turnlast':this.turnlast


        }, {
          headers: {
            'content-type': 'application/json',
            'X-Request-With': 'XMLHttpRequest',
            'token': window.sessionStorage.getItem('token')
          }
        }
      )
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.getparamList()
    },



  },
  filters: {

  }
}
</script>

<style lang="less" scope>
.el-row {
    margin-bottom: 20px;
    &:last-child {
      margin-bottom: 0px;
      align:'center'
    }
  }

.el-label{
  align:'center'
}
</style>
